Skip to content

Conversation

@Avasam
Copy link
Collaborator

@Avasam Avasam commented Oct 23, 2024

def __getattr__(name: str) -> Any: ... is the same technique typeshed uses for incomplete and dynamic stubs

Fixes plenty of attribute access issues concerning pywintypes and pythoncom as (incorrectly) found by different checkers (mypy, pyright, pylint, etc.) and language servers (Pylance, PyCharm, ...) both for pywin32 internally and users of pywin32.

(internally this also solves a handful of mypy's misc, name-defined, attr-defined, and pyright's reportAttributeAccessIssue warnings)

@Avasam Avasam changed the title mypy: fix and re-enable misc + name-defined mypy: fix plenty of misc + name-defined + attr-defined Oct 23, 2024
@Avasam Avasam changed the title mypy: fix plenty of misc + name-defined + attr-defined mypy: fix plenty of misc + name-defined + attr-defined by clearly making pythoncom.py and pywintypes.py dynamic Oct 23, 2024
@Avasam Avasam changed the title mypy: fix plenty of misc + name-defined + attr-defined by clearly making pythoncom.py and pywintypes.py dynamic Fix plenty of mypy misc+name-defined+attr-defined and pyright reportAttributeAccessIssue by clearly making pythoncom.py and pywintypes.py dynamic Oct 23, 2024
@Avasam Avasam changed the title Fix plenty of mypy misc+name-defined+attr-defined and pyright reportAttributeAccessIssue by clearly making pythoncom.py and pywintypes.py dynamic Fix plenty of mypy misc+name-defined+attr-defined and pyright reportAttributeAccessIssue from pythoncom.py and pywintypes.py Oct 23, 2024
@Avasam Avasam marked this pull request as draft October 25, 2024 04:37
@Avasam Avasam force-pushed the mypy-fix-and-re-enable-misc-+-name-defined branch from 11a6602 to e828797 Compare October 30, 2024 01:59
@Avasam Avasam marked this pull request as ready for review October 30, 2024 02:04
@Avasam Avasam changed the title Fix plenty of mypy misc+name-defined+attr-defined and pyright reportAttributeAccessIssue from pythoncom.py and pywintypes.py Let checkers know that pywintypes and pythoncom are actually dynamic modules Apr 30, 2025
@Avasam Avasam force-pushed the mypy-fix-and-re-enable-misc-+-name-defined branch from b2d2352 to 5c43fc9 Compare April 30, 2025 21:30
@Avasam Avasam changed the title Let checkers know that pywintypes and pythoncom are actually dynamic modules Let checkers and IDEs know that pywintypes and pythoncom are actually dynamic modules Apr 30, 2025
@Avasam Avasam requested a review from mhammond April 30, 2025 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant